// 请求响应参数（不包含data）
export interface Result {
  code: string;
  msg: string;
}

// 请求响应参数（包含data）
export interface ResultData<T = any> extends Result {
  data: T;
}

// 分页响应参数
export interface ResPage<T> {
  list: T[];
  pageNum: number;
  pageSize: number;
  total: number;
}

// 分页请求参数
export interface ReqPage {
  pageNum: number;
  pageSize: number;
}

// 文件上传模块
export namespace Upload {
  export interface ResFileUrl {
    fileUrl: string;
    [key: string]: string;
  }
}

// 登录模块
export namespace Login {
  export interface ReqLoginForm {
    mobile: string;
    password: string;
    [key: string]: any;
  }
  export interface ResLogin {
    access_token: string;
    [key: string]: any;
  }
  export interface ResAuthButtons {
    [key: string]: string[];
  }
}

// 用户管理模块
export namespace User {
  export interface ReqUserParams extends ReqPage {
    currentPage: number;
    searchKey: string;
    [key: string]: any;
  }
  export interface ResUserList {
    id: number;
    name: string;
    roleId: number;
    mobile: string;
    password?: string;
    avatarUrl: string;
    sex: string;
    province: string;
    city: string;
    country: string;
    email: string;
    wechat: string;
    totalIntegral: number;
    iceIntegral: number;
    status: number;
    token: string;
    expired: Date;
    remark: string;
    isDelete: number;
    gmt_create: Date;
    gmtModified: Date;
    createBy: number;
    modifiedBy: number;
    address?: number;
    addressDetail: string;
    [key: string]: any;
  }
  export interface ResStatus {
    userLabel: string;
    userValue: number;
  }
  export interface ResGender {
    genderLabel: string;
    genderValue: number;
  }
  export interface ResDepartment {
    id: string;
    name: string;
    children?: ResDepartment[];
  }
  export interface ResRole {
    id: string;
    name: string;
    children?: ResDepartment[];
  }
  export interface ReqPassword {
    userId: "";
    newPassword: "";
    oldPassword: "";
  }
}

// 字典
export namespace Dict {
  export interface ReqDictParams {
    parentIdList?: string[];
    parentId?: string;
  }
  export interface ResDictList {
    id: number;
    name: string;
    parentId: number;
    nameEn?: string;
    remark: string;
    icon: string;
    isDelete?: boolean;
    gmt_create: string;
    gmtModified: string;
    createBy: number;
    modifiedBy: number;
    [key: string]: any;
  }
}

// 角色
export namespace Role {
  export interface ReqRoleParams {
    currentPage: number;
    searchKey: string;
  }
  export interface ResRoleList {
    id: number;
    name: string;
    nameEn?: string;
    remark: string;
    isDelete?: boolean;
    gmt_create: string;
    gmtModified: string;
    createBy: number;
    modifiedBy: number;
    [key: string]: any;
  }
}

// 菜单
export namespace Menu {
  export interface ReqMenuParams {
    currentPage: number;
    searchKey: string;
  }
  export interface ResMenuList {
    id: number;
    parentId: number;
    name: string;
    nameEn?: string;
    url: string;
    perms: string;
    typeId: number;
    icon: string;
    remark: string;
    redirect: string;
    component: string;
    activeMenu: string;
    isLink: string;
    isHide: boolean;
    isFull: boolean;
    isAffix: boolean;
    isKeepAlive: boolean;
    isDelete?: boolean;
    gmt_create: string;
    gmtModified: string;
    createBy: number;
    modifiedBy: number;
    [key: string]: any;
  }
}

// 文件
export namespace File {
  export interface ReqFileParams {
    currentPage: number;
    searchKey: string;
    typeId: string;
  }
  export interface ResFileList {
    id: number;
    name: string;
    path: string;
    typeId: number;
    remark: string;
    isDelete?: boolean;
    gmtCreate: string;
    gmtModified: string;
    createBy: number;
    modifiedBy: number;
    originalFileName: string;
    [key: string]: any;
  }
}
// 省市区
export interface Area {
  code: string;
  name: string;
  [key: string]: any;
}
// 国家
export interface Country {
  [key: string]: any;
}
//问题管理
export namespace Question {
  export interface ReqQuestionParams {
    currentPage: number;
    searchKey: string;
    title: string;
    typeId: number;
    userName: string;
  }
  export interface ResQuestionList {
    id: number;
    userId: number;
    title: string;
    content: string;
    reward: number;
    viewNumber: number;
    status: number;
    auditMessage: string;
    typeId: number;
    remark: string;
    isDelete?: boolean;
    gmtCreate: string;
    gmtModified: string;
    createBy: number;
    modifiedBy: number;
    [key: string]: any;
  }
}
// 回答管理
export namespace Answer {
  export interface ReqAnswerParams {
    currentPage: number;
    searchKey: string;
    title: string;
    typeId: number;
    userName: string;
  }
  export interface ResAnswerList {
    id: number;
    userId: number;
    questionId: number;
    content: string;
    likeNumber: number;
    commentNumber: number;
    isTop: boolean;
    remark: string;
    isDelete?: boolean;
    gmtCreate: string;
    gmtModified: string;
    createBy: number;
    modifiedBy: number;
    [key: string]: any;
  }
}
// 评论管理
export namespace Commit {
  export interface ReqCommitParams {
    id: number;
    currentPage: number;
  }
  export interface ResCommitList {
    id: number;
    userId: number;
    content: string;
    relatedId: number;
    remark: string;
    likeNumber: number;
    isDelete?: boolean;
    gmtCreate: string;
    gmtModified: string;
    createBy: number;
    modifiedBy: number;
    [key: string]: any;
  }
}

// 小课堂管理
export namespace Lesson {
  export interface ReqLessonParams {
    currentPage: number;
    searchKey: string;
    title: string;
    typeId: number;
    userName: string;
  }
  export interface ResLessonList {
    id: number;
    userId: number;
    title: string;
    content: string;
    reward: number;
    viewNumber: number;
    status: number;
    auditMessage: string;
    typeId: number;
    remark: string;
    isDelete?: boolean;
    gmtCreate: string;
    gmtModified: string;
    createBy: number;
    modifiedBy: number;
    [key: string]: any;
  }
}

// 系统设置
export namespace Setting {
  export interface ReqSettingParams {
    id: number;
    switchAnswer: boolean;
    switchQuestion: boolean;
    switchRegister: boolean;
  }
  export interface ResSettingList {
    id: number;
    switchAnswer: boolean;
    switchQuestion: boolean;
    switchRegister: boolean;
    [key: string]: any;
  }
}

// 评审
export interface Audit {
  auditMessage: String;
  id: String;
  parameterId: String;
  status: String;
}

/** 查询该文件是否上传，已上传，返回上传信息 / 初始化分片入参 */
export type UploadFileInfoType = {
  /** 参考类型 UploadUrls */
  uploadId?: string;
  originFileName?: string;
  originalFileName: string;
  size: number;
  chunkCount: number; // 分片数量
  chunkSize: number;
  md5: string;
  contentType?: string;
  prefix: string;
  userId: string;
  /** 该字段只会在秒传时返回文件地址 */
  readonly url?: string;
  /** 已上传的分片索引，没有返回 null */
  readonly listParts?: number[];
};

/** 分片成功返回的分片地址，前端直接调用进行上传 */
export type UploadUrls = {
  uploadId: string;
  urls: string[];
};

/** 数据库文件列表 */
export type FilesType = {
  id: number;
  uploadId: string;
  md5: string;
  url: string;
  bucket: string;
  object: string;
  originFileName?: string;
  originalFileName: string;
  size: number;
  type: string;
  CHUNK_SIZE: number;
  chunkCount: number;
  isDelete: string;
  createTime: string;
};
